<template>
    <div class="box">
      <h2>Son2 子组件</h2>
      从vuex中获取的值:<label>{{ $store.state.count }}</label>
      <br />
      <button @click="sub">值 - 1</button>
      <button @click="change">一秒后修改成666</button>
    </div>
  </template>

<script>
export default {
  name: 'Son2Com',
  methods: {
    sub () {
      this.$store.commit('changeCount', -1)
    },
    change () {
      this.$store.dispatch('changeCountAction', 666)
    }
  }
}
</script>

  <style lang="css" scoped>
  .box {
    border: 3px solid #ccc;
    width: 400px;
    padding: 10px;
    margin: 20px;
  }
  h2 {
    margin-top: 10px;
  }
  </style>
